
#define NO_ERROR (0)
#define FILE_OPEN_ERROR (-1)


#define INSTR_ACCEPTED (0)
#define INSTR_NOT_ACCEPTED (-1)
#define INSTR_COND_UPDATE (-2)


enum {
	COND_EQ = 0,
	COND_NE = 1,
	COND_HS = 2,
	COND_LO = 3,
	COND_MI = 4,
	COND_PL = 5,
	COND_VS,
	COND_VC,
	COND_HI,
	COND_LS,
	COND_GE,
	COND_LT,
	COND_GT,
	COND_LE,
	COND_AL,
	COND_RESERVED
};




enum {
	SVC_MODE = 0,
	USR_MODE,
	SYS_MODE,
	ABT_MODE,
	IRQ_MODE,
	FIQ_MODE,
};

enum {
	NO_SHIFT_OPER = -1,
	LSL_OPER = 0,
	LSR_OPER,
	ASR_OPER,
	ROR_OPER,
	RRX_OPER
};


enum { 
	SHIFT_IMM = 0,
	SHIFT_REG,
};

enum {
	IMM = -1,
	R0 = 0,
	R1,
	R2,
	R3,
	R4,
	R5,
	R6,
	R7,
	R8,
	R9,
	R10,
	R11,
	R12,
	R13,
	R14,
	R15,
	CPSR,
	R8_FIQ,
	R9_FIQ,
	R10_FIQ,
	R11_FIQ,
	R12_FIQ,
	R13_FIQ,
	R14_FIQ,
	SPSR_FIQ,
	R13_IRQ,
	R14_IRQ,
	SPSR_IRQ,
	R13_SVC,
	R14_SVC,
	SPSR_SVC,
	R13_UNT,
	R14_UNT,
	SPSR_UNT,
	R13_ABT,
	R14_ABT,
	SPSR_ABT
};

enum{
	IMM_INSTR = 0,
	REG_INSTR,
	SHIFTED_REG_INSTR,
};



enum{ 
	DATA_PROC_AND_MISC_INSTR1 = 0,
	DATA_PROC_AND_MISC_INSTR2,
	LOAD_STORE_WORD_AND_BYTE_INSTR1,
	LOAD_STORE_WORD_AND_BYTE_INSTR2,
	MEDIA_INSTR = LOAD_STORE_WORD_AND_BYTE_INSTR2,
	BRANCH_AND_BRANCH_LINK_INSTR1,
	BRANCH_AND_BRANCH_LINK_INSTR2,
	SUPERV_CALL_AND_COPROC_INSTR1,
	SUPERV_CALL_AND_COPROC_INSTR2,
	END_OF_OPERATION = 0xFF
};

enum{
	AND_OPERATION,
	EOR_OPERATION,
	SUBTRACT_OPERATION,
	REVERSE_SUBTRACT_OPERATION,
	ADD_OPERATION,
	ADD_WITH_CARRY_OPERATION,
	SUBTRACT_WITH_CARRY_OPERATION,
	REVERSE_SUBTRACT_WITH_CARRY_OPERATION,
	TEST_OPERATION,
	TEST_EQUIVALENCE_OPERATION,
	COMPARE_OPERATION,
	COMPARE_NEGATIVE_OPERATION,
	OR_OPERATION,
	MOVE_OPERATION,
	LOGICAL_SHIFT_LEFT_OPERATION,
	LOGICAL_SHIFT_RIGHT_OPERATION,
	ARITHMETRIC_SHIFT_RIGHT_OPERATION,
	ROTATE_RIGHT_WITH_EXTEND_OPERATION,
	ROTATE_RIGHT_OPERATION,
	BIT_CLEAR_OPERATION,
	NOT_OPERATION
};

typedef struct _ARMProcState {

	unsigned int Reg[16];
	unsigned int Bankreg[7][16];
	unsigned int Cpsr;
	unsigned int Spsr[7];

	unsigned int NFlag, CFlag, ZFlag, VFlag, IFlag, FFlag;
	unsigned int SFlag;
	unsigned int TFlag;

	unsigned int pc;
	unsigned int CurInstr; // after making a structure of a sim , I will replace that using it when I parsing an instruction.
	unsigned int Bank; // current register bank
	unsigned int Mode; // current Mode

} ARMProcState;


ARMProcState *ARMProcStateList;

